<?php

namespace App\Http\Controllers\Front;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;

class DownloadController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function download()
    {

        $agent = strtolower($_SERVER["HTTP_USER_AGENT"]);
        $is_pc = (strpos($agent,'windows nt'))?true:false;
        $is_iphone = (strpos($agent,'iphone'))?true:false;
        $is_ipad = (strpos($agent,'ipad'))?true:false;
        $is_android = (strpos($agent,'android'))?true:false;
        $is_weixin = strpos($agent, 'micromessenger')?true:false;

        if($is_weixin){

            return Redirect("http://a.app.qq.com/o/simple.jsp?pkgname=com.afuyigou.presentation");
        }

        if($is_iphone || $is_ipad){
            return Redirect("https://itunes.apple.com/cn/app/fu-yi-gou-zheng-pin-di-jia/id1141756695?mt=8");
        }

        if($is_android){
            return Redirect("http://www.afuyigou.com/afyg.apk");
        }

        return Redirect("http://a.app.qq.com/o/simple.jsp?pkgname=com.afuyigou.presentation");
    }


}
